home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / utils / convertdb / stripuser.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-26  |  2.1 KB  |  77 lines

  1. #include <exec/types.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. struct User {
  6.  char    Name[31],Pass[9],Location[30],PhoneNumber[13];
  7.  USHORT  Slot_Number;
  8.  USHORT  Sec_Status,
  9.      Sec_Board,                   /* File or Byte Ratio */
  10.      Sec_Library,                 /* Ratio              */
  11.      Sec_Bulletin,                /* Computer Type      */
  12.      Messages_Posted;
  13.  /* Note ConfYM = the last msg you actually read, ConfRead is the same ?? */
  14.  ULONG   NewSinceDate, ConfRead1, ConfRead2, ConfRead3, ConfRead4,
  15.          ConfRead5,  ConfRead6,  ConfRead7,  AccountDate;
  16.  UWORD   ScreenType, Filler1;
  17.  char    Conference_Access[10];
  18.  USHORT  Uploads, Downloads, ConfRJoin, Times_Called;
  19.  long    Time_Last_On, Time_Used, Time_Limit, Time_Total;
  20.  ULONG   Bytes_Download, Bytes_Upload, Daily_Bytes_Limit, Daily_Bytes_Dld;
  21.  char    Expert;
  22.  ULONG   ConfYM1, ConfYM2, ConfYM3, ConfYM4, ConfYM5, ConfYM6, ConfYM7,
  23.          ConfYM8, ConfYM9;
  24.  long    BeginLogCall;
  25.  UBYTE   Protocol, UUCPA, LineLength, New_User;
  26.  };
  27.  
  28. char username[200];
  29. void sr(char *s);
  30.  
  31. main(int argc,char *argv[])
  32. {
  33.    FILE *fi,*fo;
  34.    struct User U;
  35.    if(argc!=2)
  36.    {
  37.      printf("StripUser version 1.0, written by Joseph Hodge\n");
  38.      printf("usage: StripUser <pathname>\n");
  39.      printf("   ie: StripUser bbs:User.Data\n");
  40.      printf("\n");
  41.      exit(0);
  42.    }
  43.    strcpy(username,argv[1]);
  44.    sr(username);
  45.    fi=fopen(username,"rb");
  46.    if(fi==NULL)
  47.    {
  48.      printf("Error, can't open %s\n",username);
  49.      printf("\n");
  50.      exit(0);
  51.    }
  52.    strcat(username,".new");
  53.    fo=fopen(username,"wb");
  54.    while(fread((APTR)&U,sizeof(struct User),1,fi)!=NULL)
  55.    {
  56.      U.ConfYM1=U.ConfYM2=U.ConfYM3=U.ConfYM4=U.ConfYM5=U.ConfYM6=U.ConfYM7=
  57.      U.ConfYM8=U.ConfYM9=U.ConfRead1=U.ConfRead2=U.ConfRead3=U.ConfRead4=U.ConfRead5=
  58.      U.ConfRead6=U.ConfRead7=0L; U.AccountDate=time(NULL);
  59.      U.ScreenType=U.Filler1=0;
  60.      fwrite((APTR)&U,sizeof(struct User),1,fo);
  61.    }
  62.    fclose(fo);
  63.    fclose(fi);
  64.    exit(0);
  65. }
  66.  
  67. void sr(char *s)
  68. {
  69.    register int i;
  70.    i=strlen(s)-1;
  71.    while(i>-1)
  72.    {
  73.      if(*(s+i)<=32) *(s+i)='\0'; else break;
  74.      i--;
  75.    }
  76. }
  77.